﻿using System.Drawing;
using Microsoft.VisualStudio.DebuggerVisualizers;

namespace FontVisualizer
{
    class FontVisualizer : DialogDebuggerVisualizer
    {
        public FontVisualizer() : base(FormatterPolicy.NewtonsoftJson)
        {

        }
        public FontVisualizer(FormatterPolicy preferredFormatterPolicy) : base(preferredFormatterPolicy)
        {
        }

        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            IVisualizerObjectProvider3 objectProvider3 = objectProvider as IVisualizerObjectProvider3;
            Font font = objectProvider3?.GetObject<Font>();

            if(font == null)
            {
                using(FontForm form = new FontForm())
                {
                    form.ShowInTaskbar = false;
                    form.Set(font);

                    windowService.ShowDialog(form);
                }
            }
        }
    }
}